# coding=utf-8
# this script for running on PC

import socket

class mysocket:
    def __init__(self, sock=None):
        if sock is None:
            self.sock = socket.socket(
                socket.AF_INET, socket.SOCK_STREAM)
        else:
            self.sock = sock

    def connect(self, host, port):
        self.sock.connect((host, port))

    def mysend(self, msg):
        sent = self.sock.send(msg)
        if sent == 0:
            raise RuntimeError("socket connection broken")

print "Starting"
s = mysocket()
s.connect("192.168.1.7", 54321)
mes = "Врагу не здается наш гордый варяг"
text = s.mysend(mes)
print text
print "Stop"
